package com.lmscn.lms.api.model;

import com.jfinal.plugin.activerecord.Model;

import java.util.List;

/**
 * Created by Czl on 2015/9/12.
 */
@SuppressWarnings("serial")
public class SystemMsgStudent extends Model<SystemMsgStudent> {

    public static final SystemMsgStudent dao = new SystemMsgStudent();

    /**
     * 根据学员Id
     * 查询所有消息
     * @param studentId
     * @return
     */
    public List<SystemMsgStudent> findByStuId(Long studentId){
        return dao.find("select t.* from t_student_system_message t where t.student_id = ?",studentId);
    }

    /**
     * 根据学员ID,信息ID
     * @param studentId
     * @param msgId
     * @return
     */
    public SystemMsgStudent findByStuIdAndMsgId(Long studentId,Long msgId){
        return dao.findFirst("select t.* from t_student_system_message t where t.student_id = ? and t.sys_msg_id = ?",studentId,msgId);
    }
}
